1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.google.common.collect;
18
19 import com.google.common.annotations.Beta;
20 import com.google.common.annotations.GwtCompatible;
21 import com.google.common.annotations.GwtIncompatible;
22 import com.google.common.base.Equivalence;
23 import com.google.common.base.Function;
24 import com.google.common.base.MoreObjects;
25 import com.google.common.collect.MapMaker.RemovalListener;
26 import com.google.common.collect.MapMaker.RemovalNotification;
27
28 import java.util.concurrent.ConcurrentMap;
29 import java.util.concurrent.TimeUnit;
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 @Beta
48 @Deprecated
49 @GwtCompatible(emulated = true)
50 abstract class GenericMapMaker<K0, V0> {
51 @GwtIncompatible("To be supported")
52 enum NullListener implements RemovalListener<Object, Object> {
53 INSTANCE;
54
55 @Override
56 public void onRemoval(RemovalNotification<Object, Object> notification) {}
57 }
58
59
60 @GwtIncompatible("To be supported")
61 RemovalListener<K0, V0> removalListener;
62
63
64 GenericMapMaker() {}
65
66
67
68
69 @GwtIncompatible("To be supported")
70 abstract GenericMapMaker<K0, V0> keyEquivalence(Equivalence<Object> equivalence);
71
72
73
74
75 public abstract GenericMapMaker<K0, V0> initialCapacity(int initialCapacity);
76
77
78
79
80 abstract GenericMapMaker<K0, V0> maximumSize(int maximumSize);
81
82
83
84
85 public abstract GenericMapMaker<K0, V0> concurrencyLevel(int concurrencyLevel);
86
87
88
89
90 @GwtIncompatible("java.lang.ref.WeakReference")
91 public abstract GenericMapMaker<K0, V0> weakKeys();
92
93
94
95
96 @GwtIncompatible("java.lang.ref.WeakReference")
97 public abstract GenericMapMaker<K0, V0> weakValues();
98
99
100
101
102
103
104
105
106
107
108 @Deprecated
109 @GwtIncompatible("java.lang.ref.SoftReference")
110 public abstract GenericMapMaker<K0, V0> softValues();
111
112
113
114
115 abstract GenericMapMaker<K0, V0> expireAfterWrite(long duration, TimeUnit unit);
116
117
118
119
120 @GwtIncompatible("To be supported")
121 abstract GenericMapMaker<K0, V0> expireAfterAccess(long duration, TimeUnit unit);
122
123
124
125
126
127
128 @SuppressWarnings("unchecked")
129 @GwtIncompatible("To be supported")
130 <K extends K0, V extends V0> RemovalListener<K, V> getRemovalListener() {
131 return (RemovalListener<K, V>) MoreObjects.firstNonNull(removalListener, NullListener.INSTANCE);
132 }
133
134
135
136
137 public abstract <K extends K0, V extends V0> ConcurrentMap<K, V> makeMap();
138
139
140
141
142 @GwtIncompatible("MapMakerInternalMap")
143 abstract <K, V> MapMakerInternalMap<K, V> makeCustomMap();
144
145
146
147
148 @Deprecated
149 abstract <K extends K0, V extends V0> ConcurrentMap<K, V> makeComputingMap(
150 Function<? super K, ? extends V> computingFunction);
151 }